import type { CourseCategoryItem } from './courseCategory'
import type { UnitItem } from './unit'
import type { CourseMember } from './user'

export interface CourseItem {
    id: number
    name: string
    short_name: string
    category_id: number | null
    status: number
    is_show: number
    start_date: string
    end_date: string
    course_id: string
    is_user: number
    roles: number[]
    image_url: string
    description: string
    sort_order: number
    report_deadline: null
    max_students: number
    is_active: number
    creator_id: number
    created_at: string
    updated_at: string
    category: CourseCategoryItem
    members?: CourseMember[]
    units?: UnitItem[]
}

export interface UserGrade {
    student_id: number
    student_name: string
    gradeList: Grade[]
}

export interface Grade {
    id: number
    itemName: string
    itemType: string
    grade: string
    range: string
    percentage: string
    contributiontocoursetotal: null
    unit_id: number
}

export interface CourseCreateItem {
    id?: number
    image_url: string
    name: string
    short_name: string
    description: string
    course_id: string
    category_id: number | null
    report_deadline: string | null
    is_active: number
    start_date: string
    end_date: string
}

export interface ImportMemberResult {
    failed: number
    has_errors: boolean
    message: string
    results: ImportMemberItem[]
    skipped: number
    success: number
    total: number
}

export interface ImportMemberItem {
    course: string
    course_id: number
    email: string
    firstname: string
    idnumber: string
    is_new_user: boolean
    lastname: string
    message: string
    password: string
    role: string
    row: number
    status: string // skipped: 跳过; success: 成功; failed: 失败
    user_id: number
    username: string
}
